package com.funtonow.jqdk.fkcs.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.funtonow.jqdk.R;
import com.funtonow.jqdk.base.BaseFragment;
import com.funtonow.jqdk.bean.UserInfoBean;
import com.funtonow.jqdk.fkcs.ui.DkActivity;
import com.funtonow.jqdk.fkcs.ui.JhActivity;
import com.funtonow.jqdk.ui.AboutPageActivity;
import com.funtonow.jqdk.ui.FeedbackActivity;
import com.funtonow.jqdk.utils.SPUtil;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author Jiajien
 * @date 2019/7/12
 */
public class MyFragment extends BaseFragment implements View.OnClickListener {

    @BindView(R.id.tv_phone)
    TextView tvPhone;

    public static MyFragment newInstance() {
        Bundle args = new Bundle();
        MyFragment fragment = new MyFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public View getLayout(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_fk_my, null);
    }

    @Override
    public void onCreateFragment(@Nullable Bundle savedInstanceState) {

    }

    @OnClick({R.id.tv_hk, R.id.tv_jh, R.id.ll_wx, R.id.tv_complaint, R.id.tv_about})
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_hk:
                startActivity(new Intent(getActivity(), DkActivity.class));
                break;
            case R.id.tv_jh:
                startActivity(new Intent(getActivity(), JhActivity.class));
                break;
            case R.id.ll_wx:
                //ToastUtils.show("暂无借款记录");
                break;
            case R.id.tv_complaint:
                startActivity(new Intent(getActivity(), FeedbackActivity.class));
                break;
            case R.id.tv_about:
                startActivity(new Intent(getActivity(), AboutPageActivity.class));
                break;
            default:
                break;
        }
    }


    @Override
    public void onResume() {
        super.onResume();
        UserInfoBean userInfoBean = SPUtil.getUserInfo();
        if (userInfoBean!=null){
            tvPhone.setText(userInfoBean.getOpenid());
        }
    }
}
